<?php

use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Column;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;
use Dcat\Admin\Layout\Menu;

/**
 * Dcat-admin - admin builder based on Laravel.
 * @author jqh <https://github.com/jqhph>
 *
 * Bootstraper for Admin.
 *
 * Here you can remove builtin form field:
 *
 * extend custom field:
 * Dcat\Admin\Form::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
 *
 * Or require js and css assets:
 * Admin::css('/packages/prettydocs/css/styles.css');
 * Admin::js('/packages/prettydocs/js/main.js');
 *
 */
$version = "0.0.0.2";
Admin::css('/css/admin.css?v=' . $version);
app('view')->prependNamespace('admin', resource_path('views/admin'));
Column::extend('totalRow', \App\Admin\Grid\Tools\TotalRow::class);
Column::extend('superModal', \App\Admin\Extensions\SuperModal::class);
Column::extend('newEditable', \App\Admin\Grid\Displayers\NewEditable::class);
Column::extend('newAudio', \App\Admin\Grid\Displayers\NewAudio::class);


$user = Admin::user();
if ($user && $user->isRole(\App\Models\Administrator::DISPATCH_KEY)) {
    Admin::js('/js/dayjs.js');
    Admin::js('/js/clue-tip.js?v=' . $version);
}

Admin::menu(function (Menu $menu) {
    if (admin_setting('enable_clue_tags'))
        $menu->add([
            [
                'id' => '1', // 此id只要保证当前的数组中是唯一的即可
                'title' => '标签管理',
                'icon' => 'fa-file-text-o',
                'uri' => 'tags',
                'parent_id' => 0,
                'permission_id' => 'tag-manager', // 与权限绑定
            ],
        ]);
});
